<template>
  <transition name="el-fade-in-linear">
    <router-view />
  </transition>
</template>

<script>
import Cookies from 'js-cookie'
import { messages } from '@/i18n'
// import { clearLoginInfo } from '@/utils'
export default {
  watch: {
    '$i18n.locale': 'i18nHandle'
  },
  data () {
    return {
      flag: true
    }
  },
  created () {
    this.i18nHandle(this.$i18n.locale)
  },
  methods: {
    i18nHandle (val, oldVal) {
      Cookies.set('language', val)
      document.querySelector('html').setAttribute('lang', val)
      document.title = messages[val].brand.lg
      // 非登录页面，切换语言刷新页面
      if (this.$route.name !== 'login' && oldVal) {
        window.location.reload()
      }
    }
  }
}
</script>

<style lang="scss">
  ::-webkit-scrollbar {
    width : 7px;
    height: 8px;
  }
  ::-webkit-scrollbar-thumb {
    border-radius: 8px;
    // box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    // background-color: #ccc;
    background-color: rgba(144,146,152,.3);
  }
  ::-webkit-scrollbar-track {
    // box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    // background-color: #f2f2f2;
    background-color: transparent;
  }
</style>
